package com.market.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.market.domain.Faq;
import com.market.manager.FaqManager;
import com.market.web.model.FaqModel;
import com.market.web.model.PictureModel;


@Controller("faqController")
@Scope("session")
public class FaqController extends GenericController<FaqManager, FaqModel, Faq> {
	
	@Autowired
	private PictureModel pictureModel;

	@Override
	@Autowired
	protected void setModel(FaqModel model) {
		this.model = model;
		
	}

	@Override
	@Autowired
	protected void setManager(FaqManager manager) {
		this.manager= manager;
		
	}
	
	/**
	 * update current's picture property, when user choose a new picture for current faq.
	 */	
	public void updateCurrentPicture(){
		this.getModelCurrent().setPicture(pictureModel.getCurrent());
	}

}
